export default {
	install(Vue){
		Vue.mixin({
			data(){
				return {
					isNetWorkError:false
				}
			},
			methods:{
				refreshExec(){
					this.chargeNetwork(()=>{
						this.refresh&&this.refresh()
					})
				},
				chargeNetwork(callback){
					uni.getNetworkType({
					    success:(res)=>{
					        if(res.networkType=="none"){
								this.isNetWorkError=true
							}
							else{
								this.isNetWorkError=false
								if(callback){
									callback()
								}
							}
					    }
					});
				}
			},
			onShow(){
				this.chargeNetwork()
			}
		})
	}
}